﻿//-----------------------------------------------------------------------
// <copyright file="FutureProgressEventArgs.cs" company="Nathan Miller">
// Copyright (c) Nathan Miller.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
//-----------------------------------------------------------------------
namespace TileTool.Threading.Future
{
    using System;

    /// <summary>
    /// Class which contains event args for the future progress event.
    /// </summary>
    public class FutureProgressEventArgs : EventArgs
    {
        #region Fields - Private

        /// <summary>
        /// Progress value for the event.
        /// </summary>
        private int progress = -1;

        #endregion

        #region Constructor

        /// <summary>
        /// Default constructor.
        /// </summary>
        public FutureProgressEventArgs()
        {
            this.Progress = -1;
            this.Status = string.Empty;
        }

        #endregion

        #region Properties - Public

        /// <summary>
        /// Gets or sets the status text for the progress event.
        /// </summary>
        public string Status
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the progress amount. This value will be 0 to 100 or -1.
        /// If the value is -1, the progress is not considered to be set.
        /// </summary>
        public int Progress
        {
            get
            {
                return this.progress;
            }

            set
            {
                if (value < -1 || value > 100)
                {
                    throw new ArgumentOutOfRangeException("Progress", "Valid range is -1 to 100.");
                }

                this.progress = value;
            }
        }

        /// <summary>
        /// Gets if the status text is valid.
        /// </summary>
        public bool StatusIsValid
        {
            get
            {
                return !string.IsNullOrEmpty(this.Status);
            }
        }

        /// <summary>
        /// Gets if the progress property is valid.
        /// </summary>
        public bool ProgressValid
        {
            get
            {
                return this.progress != -1;
            }
        }

        #endregion
    }
}
